/* 放置主界面样式 */
.client-container {
    height: 100vh;
    /* 改为视口高度，更合理 */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
}

.main {
    width: 1000px;
    height: 740px;
    background-color: rgb(238, 238, 238);
    border-radius: 5px;
    display: flex;
    z-index: 2;
    overflow: hidden;
    /* 避免内容溢出 */
}

.main .left {
    background-color: rgb(46, 50, 56);
    width: 280px;
    height: 100%;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    display: flex;
    flex-direction: column;
}

.main .right {
    width: 720px;
    height: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cover {
    width: 100%;
    height: 100vh;
    background-image: url(../pic/nuc.bg.jpg);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    filter: blur(70px);
}

.main .left .user {
    height: 80px;
    font-size: 20px;
    line-height: 80px;
    color: white;
    padding: 0 20px;
}

.main .left .search {
    height: 40px;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main .left .search input {
    height: 34px;
    width: 200px;
    line-height: 34px;
    font-size: 14px;
    color: white;
    background-color: rgb(38, 41, 46);
    border: none;
    outline: none;
    padding-left: 10px;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.main .left .search button {
    height: 34px;
    width: 34px;
    border: none;
    outline: none;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    background-image: url(../pic/搜索.png);
    background-repeat: no-repeat;
    background-size: 20px 20px;
    background-position: center center;
    background-color: rgb(38, 41, 46);
}

.main .left .search button:active {
    background-color: grey;
}

.main .left .tab {
    height: 50px;
    display: flex;
    align-items: center;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
}

.main .left .tab .tab-session {
    height: 100%;
    width: 50%;
    background-image: url(../pic/对话.png);
    background-repeat: no-repeat;
    background-size: 30px 30px;
    background-position: center center;
    cursor: pointer;
}

.main .left .tab .tab-friend {
    height: 100%;
    width: 50%;
    background-image: url(../pic/用户2.png);
    background-repeat: no-repeat;
    background-size: 30px 30px;
    background-position: center center;
    cursor: pointer;
}

.main .left .list {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 0;
}

/* 会话列表 */
.main .left .list li {
    height: 60px;
    padding: 10px 20px;
    color: white;
    border-top: 1px solid #222;
    list-style: none;
    cursor: pointer;
}

/* 会话列表高亮 */
#session-list .session-item.highlight {
    background-color: rgba(57, 75, 97, 0.26) !important;
    color: #fff !important;
}

/* 好友列表高亮（修正选择器） */
#friend-list .friend-item.highlight {
    background-color: rgba(57, 75, 97, 0.26) !important;
    color: #fff !important;
}

.main .left .list li h3,
.main .left .list li p {
    height: 20px;
    font-size: 14px;
    line-height: 20px;
    margin: 0;
}

/* 好友列表 */
.main .left .list li h4 {
    height: 40%;
    line-height: 40px;
    font-size: 20px;
    margin: 0;
}

/* 自动隐藏 */
.hide {
    display: none;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

.main .right .title {
    height: 50px;
    line-height: 50px;
    font-size: 20px;
    text-align: center;
    border-bottom: 1px solid #ccc;
    margin: 0;
}

.main .right .message-show {
    flex: 1;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    overflow: auto;
    width: 100%;
    padding: 10px 0;
    /* 新增：确保高度可滚动 */
    min-height: 0;
}

.main .right .message-show .message {
    display: flex;
    margin-top: 10px;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
}

.main .right .message-show .message-left {
    flex-direction: row;
    justify-content: flex-start;
}

.main .right .message-show .message-right {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.main .right .message-show .msg-avatar {
    flex-shrink: 0;
    margin: 0 6px;
}

.main .right .message-show .bubble {
    padding: 12px 20px;
    border-radius: 10px;
    max-width: 60%;
    word-wrap: break-word;
    margin-bottom: 2px;
    font-size: 16px;
    box-sizing: border-box;
}

.main .right .message-show .message-left .bubble {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #222;
    margin-right: 0;
}

.main .right .message-show .message-right .bubble {
    background-color: rgb(74, 214, 74);
    color: black;
    margin-left: 0;
}

.main .right .message-show .user {
    font-size: 13px;
    color: #888;
    margin-bottom: 2px;
    text-align: left;
}

.main .right .message-input {
    display: block;
    width: 100%;
    height: 80px;
    border: none;
    outline: none;
    margin-top: 0;
    background-color: rgb(238, 238, 238);
    padding: 10px;
    resize: none;
    font-size: 16px;
    box-sizing: border-box;
}

.main .right .ctrl {
    height: 50px;
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

/* 发送按钮样式 */
.main .right .ctrl button {
    height: 35px;
    width: 100px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* 按钮激活状态（有内容时） */
.main .right .ctrl button.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* 按钮点击效果（保持原有的灰色效果） */
.main .right .ctrl button:active {
    background-color: gray;
    color: white;
}

/* 表情容器：固定在会话框底部、打字框顶部，宽度与父容器一致 */
.emoji-container {
    position: relative;
    display: flex;
    align-items: center;
    /* 关键：让容器高度"包裹"按钮，不影响其他布局 */
    height: auto;
    margin: 5px;
    /* 清除原有 margin，避免挤压 */
    /* 让表情面板相对于此容器定位 */
}

/* 表情按钮：基础样式 */
.emoji-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.2s;
    margin-right: 10px;
}

.emoji-btn:hover {
    background-color: #f8f8f8;
}

.emoji-panel {
    position: absolute;
    /* 关键：改为 left: 0，让表情框靠左 */
    left: 0;
    /* 删除 transform: translateX(-50%)，不需要居中 */
    transform: none;
    bottom: calc(100% + 1px);
    /* 保持贴紧会话框底部 */
    max-width: calc(100% - 40px);
    /* 比聊天框短，可按需调整 */
    width: auto;
    /* 动态适应内容 */
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    /* 自动换行 */
    gap: 8px;
    /* 表情间距 */
    z-index: 9999;
    pointer-events: auto;
    box-sizing: border-box;
    margin-bottom: 5px;
}

/* 隐藏表情面板 */
.emoji-panel.hide {
    display: none !important;
}

/* 表情项：点击交互 */
.emoji-panel span {
    cursor: pointer;
    font-size: 24px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
    pointer-events: auto;
}

.emoji-panel span:hover {
    background-color: #f0f0f0;
}

.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 0 10px 0;
    position: relative;
    gap: 10px;
    background: none !important;
    box-shadow: none !important;
}

.user-info .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #444;
    transition: box-shadow 0.2s;
    margin-left: 16px;
}

.user-info .avatar:hover {
    box-shadow: 0 0 8px #aaa;
}

.user-info .user {
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    margin-top: 8px;
    margin-bottom: 2px;
}

.user-info .change-avatar-tip {
    font-size: 13px;
    color: #bbb;
    margin-top: 2px;
    transition: opacity 0.2s;
    opacity: 0;
    position: absolute;
    left: 50%;
    top: 54px;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    padding: 2px 10px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 10;
}

.user-info .avatar:hover+.user+.change-avatar-tip,
.user-info .avatar:hover~.change-avatar-tip {
    opacity: 1;
    pointer-events: auto;
    display: block;
}